<?php
## Définition du chemin de cette librairie
define( 'BPDPATH', dirname(__FILE__) . '/' );

## Chargement des fichiers
# Configuration
require_once(BPDPATH. 'bpd_config.php');
# Base/Connection
require_once(BPDPATH. 'bpd_db.php');
# Table
require_once(BPDPATH. 'bpd_table.php');
# Champs
require_once(BPDPATH. 'bpd_field.php');
# Enregistrements
require_once(BPDPATH. 'bpd_recordset.php');
# Enregistrement
require_once(BPDPATH. 'bpd_record.php');

## Définition des erreurs
# Connection impossible
define('ERR_DB_CONNECT', 1);
# Base introuvable 
define('ERR_DB_DATABASE', 2);


## Connection a la base
$bpd_error = 0;
$bpd_db = new BpdDb();
if ( !@$bpd_db->Connect(BPD_HOST, BPD_USER, BPD_PASS) ){
	$bpd_error = 1;
}
else {
	if ( !$bpd_db->SelectDb(BPD_BASE) ){
		$bpd_error = 2;
	}
}
$GLOBALS['$bpd_db'] = $bpd_db;
?>
